<?xml version="1.0" encoding="ISO-8859-1" ?>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1" session="false" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
  <link rel="stylesheet" href="/stylesheets/jquery-ui-1.10.3.custom.min.css" />
  <script src="/js/jquery-1.9.1.js"></script>
  <script src="/js/jquery-ui-1.10.3.custom.min.js"></script>

  <script>
  $(function() {
    var availableSymbols = [
        <c:set var="comma" value=""/>
        <c:forEach var="symbol" items="${symbols}">
            <c:out value="${comma}"/>'<c:out value="${symbol}"/>'
            <c:set var="comma" value=","/>
        </c:forEach>

    ];
    $( "#symbol" ).autocomplete({
      source: availableSymbols
    });
  });

  $(function() {
      $( "#date" ).datepicker();
    });
  </script>

</head>
<body>
<form:form method="POST" modelAttribute="position" action="/dispatch/buy">
<form:errors path="*" />
<table style="width: 400px">
<tr>
	<td>Symbol</td>
	<td><form:input path="symbol"/><form:errors path="symbol"/></td>
</tr>
<tr>
	<td>Date</td>
	<td><form:input path="date"/><form:errors path="date"/></td>
</tr>
<tr>
	<td>Purchased Price</td>
	<td><form:input path="purchasedPrice"/><form:errors path="purchasedPrice"/></td>
</tr>
<tr>
	<td>Shares</td>
	<td><form:input path="volume"/><form:errors path="volume"/></td>
</tr>
<tr>
	<td>Owner</td>
	<td><form:input path="owner"/><form:errors path="owner"/></td>
</tr>
<tr>
	<td><input type="submit" name="submit" value="BUY"/></td>
	<td><input type="button" name="Cancel" value="CANCEL" onclick="document.location.href='/dispatch/portfolio'"/></td>
</td>
</tr>


</table>
</form:form>
</body>
</html>